package com.rockxin.cat.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.rockxin.cat.R;
import com.rockxin.cat.bean.MyBankCardBean;
import com.rockxin.cat.utils.GlideCircleTransform;

import java.util.List;

/**
 * <b>类名称：    MyBankCardAdapter             <br/>
 * <b>类描述：                        <br/>
 * <b>创建人：    Lans               <br/>
 * <b>创建时间：  2018/3/4 19:06     <br/>
 * <b>修改人：                        <br/>
 * <b>修改时间：                      <br/>
 * <b>修改备注：                      <br/>
 *
 * @version 1.0.0 <br/>
 */
public class MyBankCardAdapter extends BaseQuickAdapter<MyBankCardBean, BaseViewHolder> {
    public MyBankCardAdapter(@Nullable List<MyBankCardBean> data) {
        super(R.layout.activity_my_bank_card_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MyBankCardBean item) {
        final TextView bankName = helper.getView(R.id.bankName);
        bankName.setText(item.getBank_name());
        Glide.with(mContext)
                .load(item.getBank_logo())
                .into(new SimpleTarget<GlideDrawable>() {
                    @Override
                    public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                        bankName.setCompoundDrawablesRelativeWithIntrinsicBounds(resource, null, null, null);
                    }
                });

        helper.setText(R.id.cardNum, item.getBankcard());
    }
}
